Repository navigation
[CP Stg] Fix onboarding flash after 2FA setup from Settings > Security - #98940
Conversation
…upFlow Co-authored-by: Rory Abraham <roryabraham@users.noreply.github.com>
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Web testing: blocked before the 2FA setup flow
|
| Step | Result |
|---|---|
| Navigate Home → Account → Security → Two-factor authentication | ✅ Reached |
| Reach 2FA authenticator secret key / Verify step | ❌ Blocked by magic-code gate |
| Confirm no onboarding flash after "Got it" | ❌ Not testable (flow blocked upstream) |
No JS console errors were observed up to the blocker.
Evidence
Account > Profile page with Security menu item in sidebar
Security > Two-factor authentication opens a Validate your account magic-code gate
Next Steps: This PR's fix is only verifiable by a human with inbox access to clear the magic-code gate and an authenticator app to complete TOTP setup. Reply with @MelvinBot <feedback> if you'd like me to try a different approach.
|
🚧 roryabraham has triggered a test Expensify/App build. You can view the workflow run here. |
Co-authored-by: Rory Abraham <roryabraham@users.noreply.github.com>
|
Fixed the failing Oxfmt check and pushed the fix. Cause: The updated line in Fix: Ran The other red check, |
|
The Oxfmt check I fixed in my previous push is now passing ✅, along with ESLint and Bun tests. The remaining checks (typecheck, tests, perf) are just re-running from that commit. The only red check left is |
This comment has been minimized.
This comment has been minimized.
|
The Oxfmt check is now passing — the formatting fix I pushed earlier ( The only remaining red check is |
Android testing: blocked before the 2FA setup flow
|
| Step | Result |
|---|---|
| Navigate Home → Account → Security → Two-factor authentication | ✅ Reached |
| Proceed past recovery codes and enter TOTP | ❌ Blocked by magic-code gate |
| Confirm no onboarding flash after "Got it" | ❌ Not testable (flow blocked upstream) |
No JS/console errors were observed up to the blocker.
Evidence
Validate your account magic-code gate blocking 2FA setup
"What's your work email?" onboarding step during first-run sign-up (expected for a new account)
Next Steps: This fix is only verifiable by a human using an existing account that has already completed onboarding, with inbox access to clear the magic-code gate and an authenticator app to complete TOTP setup. Reply with @MelvinBot <feedback> if you'd like me to try a different approach.
|
@MelvinBot please replace all |
|
@linhvovan29546 @thelullabyy One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
Done ✅
|
| // Forced onboarding 2FA always enters via Settings > Security (from the require-2FA overlay). | ||
| const isForcedOnboardingHandoff = AccountUtils.isForced2FAOnboardingSetup(account, false) || (!!account?.requiresTwoFactorAuth && isIncompleteOnboarding && hasSavedOnboardingPath); | ||
| // Gate on the real hasCompletedGuidedSetupFlow so the handoff only fires for users who haven't finished | ||
| // guided setup; passing a literal false made it fire for every user setting up 2FA from Settings > Security. |
There was a problem hiding this comment.
❌ CONSISTENCY-16 (docs)
The added comment joins two independent statements with a semicolon ("...who haven't finished guided setup; passing a literal false made it fire for every user setting up 2FA from Settings > Security."). Per the plain-comment-style rule, use two separate sentences instead of a semicolon so the comment reads as natural prose.
Split it into two sentences, for example:
// Gate on the real hasCompletedGuidedSetupFlow so the handoff only fires for users who haven't finished
// guided setup. Passing a literal false made it fire for every user setting up 2FA from Settings > Security.Reviewed at: 8b09fd5 | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
There was a problem hiding this comment.
The CONSISTENCY-16 finding is valid — the added comment joins two independent statements with a semicolon, which the plain-comment-style rule says to split into two sentences. The suggested fix is correct:
// Gate on the real hasCompletedGuidedSetupFlow so the handoff only fires for users who haven't finished
// guided setup. Passing a literal false made it fire for every user setting up 2FA from Settings > Security.I can only make code changes when directed by the PR author, an assignee, or an existing co-author. To have me implement this, the PR assignee or author should reply with a request tagging me.
|
@MelvinBot Please check and fix this https://github.com/Expensify/App/pull/98940/changes#r3815841626 if needed |
Reviewer Checklist
Screenshots/VideosiOS: HybridAppScreen.Recording.2026-08-20.at.02.32.03.movMacOS: Chrome / SafariScreen.Recording.2026-08-20.at.02.24.06.mov |
|
The only code-related failure — the Oxfmt check — was already fixed and pushed (the long assignment on The two checks still red aren't code issues and can't be resolved by a push:
Both just require a human reviewer, so there's nothing further for me to fix here. |
|
The only code-related failure (the Oxfmt check) was already fixed in my earlier commit and is now passing. The two checks still showing red are both human-gated and can't be resolved by pushing code:
No further code fix is needed from me. |
|
🚧 Beamanator has triggered a test Expensify/App build. You can view the workflow run here. |
…ffFlash [CP Stg] Fix onboarding flash after 2FA setup from Settings > Security (cherry picked from commit b0243e6) (cherry-picked to staging by Beamanator)
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Cherry-picked to staging by https://github.com/Beamanator in version: 9.4.56-3 🚀
|
Help site review: no docs changes requiredI reviewed the changes in this PR against Why: This PR is a purely internal bug fix. It changes a single boolean argument in The 2FA setup steps documented in @roryabraham — no linked help site PR was created because this fix doesn't alter any documented behavior. Let me know if you'd like me to reconsider. |
|
🚀 Deployed to production by https://github.com/Beamanator in version: 9.4.56-3 🚀
Bundle Size Analysis (Sentry): |
|
🚀 Cherry-picked to staging by https://github.com/Beamanator in version: 9.4.57-0 🚀
|
Help site review: no docs changes requiredI reviewed the changes in this PR and no help site updates are needed under This is a purely internal bug fix: The relevant help article, Two-Factor Authentication (2FA), already documents the intended setup flow (Account > Security > Two-Factor Authentication → save recovery codes → Continue → enter authenticator code → Verify) and never described the buggy onboarding flash. Since this PR simply restores the already-documented behavior and adds no new feature, workflow, or UI, there is nothing in the docs to add or correct. @roryabraham, no help site PR was created because this fix doesn't change any documented behavior. Let me know if you'd still like a docs PR opened for any reason. |
|
🚀 Deployed to production by https://github.com/Beamanator in version: 9.4.57-3 🚀
Bundle Size Analysis (Sentry): |




Explanation of Change
After completing 2FA setup from Settings > Security (Download codes → enter code → "Got it"), users were briefly seeing the onboarding "What's your work email?" / "What's your name" screens flash before landing on Home.
DynamicSuccessPagedecides whether to hand the user back into the onboarding flow viaisForced2FAOnboardingSetup(account, hasCompletedGuidedSetupFlow), which returnstrueonly whentwoFactorAuthSetupInProgressand the user has not completed guided setup. The call site was passing a hardcodedfalseforhasCompletedGuidedSetupFlow, which made the guardhasCompletedGuidedSetupFlow === falsealwaystrue— collapsing the check to justtwoFactorAuthSetupInProgress. SincesetCodesAreCopied()setstwoFactorAuthSetupInProgress = trueat the "Download codes" step, the forced-onboarding handoff fired for every user setting up 2FA from Settings > Security (including existing users who had long finished onboarding), briefly resuming the onboarding flow.This PR passes the real
hasCompletedGuidedSetupFlowvalue (already computed one line above) instead of the literalfalse, matching the sibling caller inToggleTwoFactorAuthForm. The forced-onboarding handoff now only fires for users who genuinely haven't completed guided setup (the domain-migration / required-2FA-before-onboarding case), so existing users setting up 2FA voluntarily no longer see the onboarding flash.Fixed Issues
$ #98938
$ #98933
PROPOSAL:
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari